//
//  GroupLabelAndImageView.m
//  aMoment
//
//  Created by dllo on 15/10/15.
//  Copyright © 2015年 LuckyHan. All rights reserved.
//

#import "GroupLabelAndImageView.h"
#import "AllHeaderFiles.h"

@implementation GroupLabelAndImageView

- (void)dealloc
{
    [_coverImageView release];
    [_titleLabel release];
    [_contentLabel release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _coverImageView = [[UIImageView alloc] init];
        _coverImageView.contentMode = UIViewContentModeScaleAspectFill;
        _coverImageView.clipsToBounds = YES;
//        _coverImageView.backgroundColor = [UIColor redColor];
        [self addSubview:_coverImageView];
        [_coverImageView release];
        
        _titleLabel = [[UILabel alloc] init];
//        _titleLabel.backgroundColor = [UIColor grayColor];
//        _titleLabel.alpha = .5;
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.font = [UIFont systemFontOfSize:FONTSIZE_MIDDLE];
        [self addSubview:_titleLabel];
        [_titleLabel release];
        
        _contentLabel = [[UILabel alloc] init];
//        _contentLabel.backgroundColor = [UIColor grayColor];
//        _contentLabel.alpha = .5;
        _contentLabel.textColor = [UIColor lightGrayColor];
        _contentLabel.font = [UIFont systemFontOfSize:FONTSIZE_SMALL];
        _contentLabel.numberOfLines = 0;
        [self addSubview:_contentLabel];
        [_contentLabel release];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    _coverImageView.frame = CGRectMake(0, 0, self.Width, self.Height);
    _titleLabel.frame = CGRectMake(0, 0, _coverImageView.Width, 20 * FIT_HEIGHT);
    _contentLabel.frame = CGRectMake(_titleLabel.X, _titleLabel.Y + _titleLabel.Height, _titleLabel.Width, _coverImageView.Height - _titleLabel.Height);
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
